package cn.zf233.jwtshiro.service.impl;

import cn.zf233.jwtshiro.entity.User;
import cn.zf233.jwtshiro.mapper.UserMapper;
import cn.zf233.jwtshiro.service.UserService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by zf233 on 2021/7/12
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User login(String username, String password) {
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.eq("username", username);
        wrapper.eq("password", password);
        return userMapper.selectOne(wrapper);
    }

    @Override
    public List<User> list() {
        return userMapper.selectList(new QueryWrapper<>());
    }

}
